using System;
using System.Collections.Generic;
using System.Text;
using Hermes.Framework;

namespace Hermes.Framework.Implementation.File
{
    public class TxFileMove : TxOperationTemplate, ITransactableMove
    {
        protected ITransactableOperationAbstractFactory factory = null;

        public TxFileMove(string srcFileName, string dstFileName)
            : base(srcFileName, dstFileName)
        {

        }

        public ITransactableOperationAbstractFactory AbstractFactory
        {
            set
            {
                this.factory = value;
            }
            get
            {
                return this.factory;
            }
        }

        #region ITransactableCopy

        public void Move()
        {
            base.Execute(base.srcFileName, base.dstFileName);
        }

        #endregion

        protected override void Operate()
        {
            ITransactableCopy copy = this.factory.GetCopy(base.srcFileName, base.dstFileName);
            copy.Copy();

            ITransactableDelete delete = this.factory.GetDelete(base.srcFileName);
            delete.Delete();
        }

        public override void Commit()
        {
            
        }

        public override void Rollback()
        {
            
        }
    }
}
